<script setup>
import { User, Document,
  Menu as IconMenu,
  Location,
  Setting} from "@element-plus/icons-vue";
import router from "../router/index.js";
import { ref, reactive } from "vue";
import { ElMessage } from "element-plus";


const options = reactive(["adminHome/admin_booklist", "adminHome/admin_userlist",""]);

const i = ref(1)
const admin_change =(index) =>{
    router.push("/"+options[index-1])
}
admin_change(i.value)
</script>

<template>
  <div>
    <div class="admin_top">“小李牌”图书馆后台管理</div>
    <div class="admin_main">
      <div class="admin_main_l">
        <el-menu
          default-active="1"
          class="el-menu-vertical-demo"
          @select="admin_change"
        >
          <el-menu-item index="1">
            <el-icon><icon-menu /></el-icon>
            <span>书籍列表</span>
          </el-menu-item>
          <el-menu-item index="2">
            <el-icon><document /></el-icon>
            <span>用户列表</span>
          </el-menu-item>
          <el-menu-item index="3">
            <el-icon><setting /></el-icon>
            <span>退出登录</span>
          </el-menu-item>
        </el-menu>
      </div>
      <div class="admin_main_r">
        <router-view></router-view>
      </div>
    </div>
  </div>
</template>

<style>
.admin_top {
  min-width: 1000px;
  height: 90px;
  background-color: beige;
  line-height: 70px;
  font-size: 30px;
  padding-left: 400px;
}
.admin_main {
  display: flex;
  min-width: 1000px;
  height: 640px;
  background-color: aliceblue;
}
.admin_main_l {
  width: 200px;
}
.admin_main_r {
  flex: 1;
  background-color: seashell;
}
</style>